<template>
  <div
    class="px-[15px] flex items-center justify-center color-[var(--el-text-color-regular)]"
    @click="toggleClick"
  >
    <!-- <svg-icon
      class="hamburger"
      :class="{ 'is-active': isActive }"
      icon-class="indent-decrease"
    /> -->
    <span class="hamburger-icon" :class="{ open: !isActive }">
      <span></span>
      <span></span>
      <span></span>
    </span>
  </div>
</template>
<script setup lang="ts">
defineProps({
  isActive: {
    required: true,
    type: Boolean,
    default: false,
  },
});

const emit = defineEmits(["toggleClick"]);

function toggleClick() {
  emit("toggleClick");
}
</script>

<style scoped lang="scss">
.hamburger {
  vertical-align: middle;
  cursor: pointer;
  transform: scaleX(-1);
}

.hamburger.is-active {
  transform: scaleX(1);
}

.hamburger-icon {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 14px;
  cursor: pointer;

  span {
    position: absolute;
    left: 0;
    display: block;
    width: 100%;
    height: 2px;
    background-color: rgb(255 255 255);
    border-radius: 2px;
    transition: 0.3s cubic-bezier(0.8, 0.5, 0.2, 1.4);
    transition: 0.3s cubic-bezier(0.8, 0.5, 0.2, 1.4);
  }

  span:nth-child(1) {
    top: 0;
    width: 80%;
  }

  span:nth-child(2) {
    top: 6px;
  }

  span:nth-child(3) {
    bottom: 0;
    width: 60%;
  }
}

.hamburger-icon.open {
  transform: rotate(-90deg);
  transform: rotate(-90deg);

  span:nth-child(1) {
    top: 5px;
    left: 1px;
    width: 20px;
    transition-delay: 150ms;
    transition-delay: 150ms;
    transform: rotate(90deg);
    transform: rotate(90deg);
  }

  span:nth-child(2) {
    top: 13px;
    left: 3px;
    width: 10px;
    transition-delay: 50ms;
    transition-delay: 50ms;
    transform: rotate(45deg);
    transform: rotate(45deg);
  }

  span:nth-child(3) {
    top: 13px;
    left: 9px;
    width: 10px;
    transition-delay: 0.1s;
    transition-delay: 0.1s;
    transform: rotate(-45deg);
    transform: rotate(-45deg);
  }
}
</style>
